<?php

 

Route::get('/', 'Front\Pagecontroller@index')->name('home');
Route::get('set-clear-both', 'Front\PageController@seting')->name('set-clear-both');
Route::get('checkLogin', 'Front\PageController@checkLogin')->name('check-login');
Route::prefix('panic-buying')->group(function(){
 Route::get('/','Front\PanicBuyingController@index')->name('buying');
});

Route::get('shop', 'Front\CategoryController@index')->name('categoris');
Route::get('list/{category}', 'Front\CategoryController@show')->name('pcate');

Route::get('details-attr', 'Front\DetailsController@show_attr');
Route::get('details-unique-attr', 'Front\DetailsController@unique_attr')->name('unique.attr');
Route::get('details/{product?}', 'Front\DetailsController@details')->name('details');

Route::get('search', 'Front\SearchController@index')->name('search');

Route::get('shop-cart', 'Front\CartController@index')->name('shop-cart');

Route::get('shop-cart/{product}', 'Front\CartController@create')->name('add-cart');
Route::post('shop-crat/{rowId}/update', 'Front\CartController@update')->name('update-cart');
Route::get('shop-cart/{rowId}/destroy', 'Front\CartController@destroy')->name('cart-del');
Route::get('destory-cart', 'Front\CartController@clear')->name('destory-cart');


Route::get('checkout', 'Front\CheckoutController@index')->name('checkout');
Route::post('checkout', 'Front\CheckoutController@store')->name('checkout-data');
 
Route::get('save-order', 'Front\OrderController@save')->name('orders');


Route::middleware('auth:web')->group(function () {
    Route::get('profile', 'Front\ProfileController@index')->name('profile');
    Route::get('adress', 'Front\ProfileController@adress')->name('adress');
    Route::get('orders', 'Front\OrderController@index')->name('orders');
    Route::get('save/order', 'Front\OrderController@save')->name('order.save');
    Route::get('pay/order', 'Front\OrderController@payment')->name('order.pay');
    Route::get('wishlist', 'Front\WishlistController@index')->name('index.wishlist');
    Route::post('wishlist', 'Front\WishlistController@create')->name('add-wishlist');
    Route::get('wishlist/{id}', 'Front\WishlistController@destroy')->name('wishlist.destroy');
});




Auth::routes();




/**
* Admin Router
**/
Route::middleware('auth:admin')->prefix('admin')->namespace('Admin')->group(function () {
    Route::get('home', 'IndexController@index')->name('admin.home');
    Route::get('logout', 'IndexController@logout')->name('admin.logout');
    Route::get('clear/cache','IndexController@clear')->name('admin.clear.cache');
    /**
    * web Site Config
    *
    **/
    Route::resource('wechat', 'WeChatController');
    /**
    * Product Panel
    **/
    Route::resource('product', 'ProductController');

    Route::post('product/number/{id}', 'ProductNumberController@store')->name('product.number.store');

    Route::get('product/{id}/number', 'ProductNumberController@number')->name('product.number');
    Route::get('product/property/number_list', 'ProductNumberController@show')->name('product.number_list');
    Route::post('product/{product}/property', 'ProductController@property')->name('product.property.store');
    Route::post('file/multiple/create', 'ProductController@createUpload')->name('cupload');
    
    Route::post('file/multiple/{product_id?}/{product?}', 'ProductController@uploadFile')->name('upload');


    Route::resource('categories', 'CategoriesController');
    Route::resource('pages', 'PagesController');
    Route::resource('pro-type', 'ProductTypeController');
    // Route::resource('attributes', 'AttributeController');
    Route::get('attributes/{id}', 'AttributeController@show')->name('attributes.typeshow');
    Route::get('attributes/create/{typeId?}', 'AttributeController@create')->name('attributes.create');
    Route::post('attributes', 'AttributeController@store')->name('attributes.store');
    Route::get('attributes/edit/{id}&type_id={typeId}', 'AttributeController@edit')->name('attributes.edit');
    Route::put('attributes/{id}', 'AttributeController@update')->name('attributes.update');
    Route::delete('attributes/{id}/{type_id}', 'AttributeController@destroy')->name('attributes.destroy');
    Route::get('attributes/del/{id}', 'AttributeController@del_attr')->name('attributes.destroy');
});

Route::get('/admin/login', 'Admin\LoginController@index')->name('admin.login.page');
Route::post('/admin/login', 'Admin\LoginController@login')->name('admin.login');
